<?php
import slim3.service.ServiceFactory;

	$factory = ServiceFactory::getInstance();
	$service = $factory->getManager()->getDaoService();

	$name = $_POST["name"];
	$comment = $_POST["coment"];
	$name = htmlspecialchars($name, ENT_QUOTES);
	$comment = htmlspecialchars($comment, ENT_QUOTES);

	$service->putMessage($name, $comment);

	// index.phpにリダイレクト
	header("HTTP/1.1 301 Moved Permanently");
	header("Location: /index.php");
?>